<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
  <head>
    <meta charset="UTF-8">
    <title>sinocares</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="../css/font.css">
    <link rel="stylesheet" href="../css/xadmin.css">
    <script src="../js/jquery.min.js"></script>
    <script type="text/javascript" src="../lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="../js/xadmin.js"></script>
  </head>
  
  <body class="layui-anim layui-anim-up">
    <div class="x-nav">
      <span class="layui-breadcrumb">
        <a>
          <cite>检测项目</cite></a>
      </span>
    </div>
	<div id="jiancha">
    <div class="x-body">
   <div class="layui-row layui-bg-gray">
					<br />
					
					<form class="layui-form layui-col-md12 x-so" style="width: 800px;">
<div class="layui-inline">
                    <label for="L_pass" class="layui-form-label" style="font-size: 14px;"><b>${custid.cname}/${custid.csex}/${custid.cage}岁</b></label>

                </div>
                <div class="layui-inline" style="margin-left: 120px;">
                    <label for="L_pass" class="layui-form-label">	身高</label>
                    <div class="layui-input-inline">
                        <input id="shenggao" class="layui-input" placeholder="请输入">cm</div>
                </div>

                <div class="layui-inline" >
                    <label for="L_pass" class="layui-form-label">	 体重 </label>
                    <div class="layui-input-inline">
                        <input id="weigth" class="layui-input" placeholder="请输入">kg</div>
                </div>
							
						

            </form>
            <div style="margin-left: 1200px; ">
            <button id="creatcudet"  class="layui-btn" lay-submit="" lay-filter="sreach"><a href="#">生成报告单</a></button>
								
    </div>
        </div>
            <br />
           <div class="layui-form-item cudDiv" th:each="cud : ${cudetailsByid}">
                <input type="hidden" class="cudnumber" th:value="${cud.cudnumber}">
                <label for="L_pass" class="layui-form-label cudname" th:text="${cud.cudname}">
                </label>
                <div class="layui-input-inline">
                    <input class="layui-input asd" placeholder="请输入">
                </div>
                <div class="layui-input-inline" style="width: 109px;">
                    <select name="province" lay-filter="province" class="province">
                      <option th:text='${cud.unit}'></option>
                    </select>
                </div>
           </div>

        </div>
	</div>
    <script>

		$(function () {
			$("#creatcudet").click(function () {
			    var shenggao = $("#shenggao");
                var weigth = $("#weigth");

                if (shenggao.val() == "") {
                    layer.msg("检测者身高还未填写", {time: 1000, icon: 5, shift: 6});
                    return false;
                }

                if (weigth.val() == "") {
                    layer.msg("检测者体重还未填写", {time: 1000, icon: 5, shift: 6});
                    return false;
                }

                var as = $(".asd");
                var cudname = $(".cudname");
                var province = $(".province");

                var cudte = new Array();
                var i=0;
                $(".cudDiv").each(function () {
                    if ($(this).find($(".cudnumber")).val() == ""){
                        layer.msg("检测项目未填写完整", {time: 1000, icon: 5, shift: 6});
                    } else {
                        var all = {};
                        all["cudnumber"] = $(this).find($(".cudnumber")).val();
                        all["asd"] = $(this).find($(".asd")).val();
                        all["province"] = $(this).find($(".province")).val();
                        cudte[i] = all;
                        i++;
                    }
                });
                $.ajax({
                    url : "/percudetails",
                    type : "post",
                    dataType : "json",
                    data : {
                        "shengao" : shenggao.val(),
                        "weight" : weigth.val(),
                        "cudte" : JSON.stringify(cudte)
                    }
                });

            })

        });

      layui.use('laydate', function(){
        var laydate = layui.laydate;
        
        //执行一个laydate实例
        laydate.render({
          elem: '#start' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
          elem: '#end' //指定元素
        });
      });


    </script>
  </body>

</html>